<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
<script type="text/javascript">
(function(){
	alert("02_JS对象构造[2].html");
})();

var Point = function(_x,_y){
	var x = _x;
	var y = _y;
	this.count1 = function(){
		var	count = x + y;
		return count;
	}
}

var p = new Point(5,6);

Point.prototype.count2 = function(){
	var	count = x+y; //这个地方会报错,
	return count;
}

alert("p : " + typeof(p));
alert("p.x : " + p.x);
alert("p.y : " + p.y);
alert("p.count1() : " + p.count1());
alert("p.count2() : " + p.count2());

//在一个对象中定义的this.xxx = funciton(){}方法,不会被对象.prototype.xxx覆盖.

//闭包的构成有两种,一种是对象直接返回一个function()方法
</script>
</html>